package com.wenson.behavior.mediator;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName: BaseChatRoom
 * @Author: luowangcheng
 * @Date: 2024/6/16 10:12
 * @Description:
 */
public abstract class BaseChatRoom {
    protected String name;
    protected List<User> users = new ArrayList<>();

    public BaseChatRoom(String name) {
        this.name = name;
    }

    protected void register(User user){
        this.users.add(user);//用户进入聊天室
    }

    protected void unregister(User user){
        users.remove(user);//用户注销
    }

    protected abstract void sendMsg(User from, User to, String msg);

    protected abstract String processMsg(User from, User to, String msg);
}
